#ifndef MAINFRAME_H
#define MAINFRAME_H
#include "ContainerAndImagePanels.h"
#include  <list>

/////////////////////////////////////
class TNewMark : public QDialog
{
	Q_OBJECT

public:
	TNewMark();
	//
	QString GetText(){ return text->toPlainText(); }
private:
	QTextEdit *text;
};


class TSETSIZE : public QDialog
{
	Q_OBJECT

public:
	TSETSIZE();
	//
	QString GetText(){ return text->toPlainText(); }
private:
	QTextEdit *text;
};

/////////////////////////////////////

class TSetWL : public QDialog
{
    Q_OBJECT
/*
    struct cmbWL{
        cmbWL(int _w, int _l): w(_w), l(_l) {}    
        int w, l;
    };
*/
public:
    TSetWL();
    //
    int getX(){ return spinX->value(); }
    int getY(){ return spinY->value(); }
private slots:
    void itemActiveated( int i );
	void ChangeWL(int i );
private:
    QSpinBox *spinX, *spinY;
    QComboBox *cb;
signals:
	void signalWLChanged(int w, int l);
};

/*
class TOverlaySetup : public QDialog{
	Q_OBJECT	
public slots:
	void overlayOk();
public:
	TOverlaySetup();
	std::vector<QComboBox *> comboBoxesCT;
	std::vector<QCheckBox *> checkBoxesCT;
	std::vector<QComboBox *> comboBoxesMR;
	std::vector<QCheckBox *> checkBoxesMR;
	std::vector<QComboBox *> comboBoxesXA;
	std::vector<QCheckBox *> checkBoxesXA;
	std::vector<QComboBox *> comboBoxesUNKNOWN;
	std::vector<QCheckBox *> checkBoxesUNKNOWN;
};

class TConnectMenu : public QDialog
{
	Q_OBJECT
public:
	TConnectMenu();	
public slots:
	void connectToSrv();
	void httpDone(bool);
	void setValue(int, int);
private:
	QLineEdit * edit1;
	QLineEdit * edit2;
	QLineEdit * edit3;
	QFile file; 
	QHttp http; 
	QTime time;
	QProgressBar * progress;
};

*/

//////////////////////////////////////
class CMainFrame : public QObject
{
	Q_OBJECT
public:	
	QWidget * imageViewer;
	HINSTANCE hInstance;
	HWND parentHwnd;	
	void OnPaint();
	int  OnCreate();
	void onInFocus();
	void onOutFocus();
	void OnKeyDown(UINT, UINT, UINT);
	void OnKeyUp(UINT, UINT, UINT);

public:
	CMainFrame( HWND _parent );
	virtual ~CMainFrame();

	public slots:
	void changeWL(int, int);
	void changeSplitMain(int x, int y);
	void changeSplitSeries(int x, int y);
	void changeSplitFrames(int x, int y);
public: 
	void onNOFILTER();
	void onBLURFILTER();
	void onSHARPFILTER();
	void onSETVIEWCHOSEN();	
	void onSETVIEWUNCHOSEN();
	void onSETVIEWALL();
	void onCHECKEVEN();
	void onCHECKODD();
	void onUNCHECKALL();
	void onCHANGEPOSITIONMAIN1();
	void onCHANGEPOSITIONMAIN2();
	void onCHANGEPOSITIONMAIN3();
	void onCHANGEPOSITIONMAIN4();
	void onCHANGEPOSITIONFRAME1();
	void onCHANGEPOSITIONFRAME2();
	void onCHANGEPOSITIONFRAME3();
	void onCHANGEPOSITIONFRAME4();
	void onCHANGEPOSITIONFRAMECUSTOM();
//	void onCONNECT();
//	void onOVERLAYSETUP();
	void onCHANGEPOSITIONSTUDY1();
	void onCHANGEPOSITIONSTUDY2();
	void onCHANGEPOSITIONSTUDY3();
	void onCHANGEPOSITIONSTUDY4();
	void onCHANGEPOSITIONSTUDYCUSTOM();
	void onSETWL();
	void onCHOSEPANEL();
	void onCONTRASTIMAGE();
	void onMOVEIMAGE();
	void onTURNVERT();
	void onROTATELEFT();
	void onROTATERIGHT();
	void onREFLECT();
	void onTURNHOR();
	void onSIZEDIST();
	void onSETSCALE();
	void onMPRPLANE();
	void onDO2MPRPLAINES();
	void MPRPLANE();
	void onTEXT();
	void onANGLE();
	void onDELETEMARKS();
	void onHIDEMARKS();
	void onHIDEOVERLAY();
	void onCURVE();
	void onSPOT();	
	void onVIEWONESTUDY();
	void onAUTOFILLSTUDIES();
	void onADDTEXTMARK();
	void onSETSCALE(int dist);
	void onSHOWREFLINE();
	void onSHOWREFLINEALL();

protected:
	void flushAllPanelsStates();
	void dock_toolbars();

public:
	RECT getRectNonToolBar(); 
	void setMOVIE(bool isMovie);
	void onMOVEMPR();
	void onHIDEOVERLAYMPR();	
	void savePanelStructure();
	void resetPanelStructure();
	HWND hwndContainerPanel1;
	HWND hwndContainerPanel2;
	HWND hwndContainerPanel3;
	HWND hwndContainerPanel4;
	ContainerPanel * containerPanel1;
	ContainerPanel * containerPanel2;
	ContainerPanel * containerPanel3;
	ContainerPanel * containerPanel4;
	int windowPosition;
	BOOLEAN isViewOneStudy;
	int numberOfViewedOnePanel;
	int numberOfContainerWindows;
	int prevWindowPosition;
	//ContainerPanel * myContainerPanel;
	
};

class TSetCustomSplit : public QDialog
{
	Q_OBJECT

public slots:
	void apply1();
	void apply2();
	void apply3();	
	//

public :
	TSetCustomSplit();
	int getX(){ return spinX->value(); }
	int getY(){ return spinY->value(); }
	int getX2(){ return spinX2->value(); }
	int getY2(){ return spinY2->value(); }
	int getX3(){ return spinX3->value(); }
	int getY3(){ return spinY3->value(); }
	void createGroup1(QString label);
	void createGroup2(QString label);
	void createGroup3(QString label);
	//CMainFrame
	CMainFrame * cMainFrame;
private:
	QSpinBox *spinX, *spinY, *spinX2, *spinY2, *spinX3, *spinY3;
	QHBoxLayout *hl0;
	QHBoxLayout *hl1;
	QHBoxLayout *hl2;
	QHBoxLayout *hl3;
	QHBoxLayout *hl4;
	QHBoxLayout *hl5;
	QHBoxLayout *hl6;	
signals:
	void signalSplitApply1(int x, int y);
	void signalSplitApply2(int x, int y);
	void signalSplitApply3(int x, int y);	
};
#endif